#ifndef SESSIONMANAGERTEST_HPP
#define SESSIONMANAGERTEST_HPP

#include <gtest/gtest.h>
#include "SessionManager.h"

TEST(SessionSerialization, ShoudWorkAsExpected)
{
  Session one("1","2",static_cast<time_t>(10002));
  Session two("2","2",static_cast<time_t>(10003));
  SessionManager manager;

  manager.insert(one);
  manager.insert(two);

  ASSERT_EQ(2,manager.size());

  manager.serialize("./session.csv");
  manager.deserialize("./session.csv");

  ASSERT_EQ(2,manager.size());

  const Session *gotOne = manager.sessionById(one.id());
  const Session *gotTwo = manager.sessionById(two.id());

  ASSERT_TRUE(gotOne != 0);
  ASSERT_TRUE(gotTwo != 0);
  ASSERT_EQ(one, *gotOne);
  ASSERT_EQ(two, *gotTwo);

}

#endif // SESSIONMANAGERTEST_HPP